package com.zhangsun.springShiro.system.controller;

import com.zhangsun.springShiro.base.bean.ResponseData;
import com.zhangsun.springShiro.common.utils.ResponseUtil;
import com.zhangsun.springShiro.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class LogoutController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/user/logout")
    @ResponseBody
    public ResponseData logout(HttpServletRequest request) {
        userService.logout(request);
        return ResponseUtil.success("登出成功");
    }

}
